<%@ page contentType="text/html; charset=UTF-8"   %>
  <%@include file="../inc/public.inc" %> 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>费用信息列表(expensesInfo/expensesList.jsp)</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<link href="<%=basePath%>css/form.css" rel="stylesheet" type="text/css">
	<script language="javascript" type="text/javascript"
			src="<%=basePath%>js/My97DatePicker/WdatePicker.js"></script>
			
			
			
  </head>
  
 <body>
<p>&nbsp;</p>
<form action="ExpensesInfoServlet.servlet?opt=searchExpensesInfoList" id="frm" name="frm" method="post">
<table width="100%" align="center"  height="20" align=center border="0" cellspacing="0" cellpadding="0">
  			<tr bgcolor="#c0c0c0"> 
            	<td bgcolor="#c0c0c0" width="41%" height="4" align="left"> 
            		<font face=宋体 color=#000000><b>费用信息列表</b></font>
            	</td>
            	<td height="19" width="59%"></td>
         	 </tr>
          
 </table>
	<table  align="center" width="80%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
  	 
    <tr bgcolor="#FFFFFF"> 
       <td   bgcolor="#000000" width="59%" height="1"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
    	 
      <td  align=right  >
	  <a href="javascript:addTeamData();">[新增团体费用]</a>
	  &nbsp;&nbsp;&nbsp;&nbsp;
          <a href="javascript:addIndividualData();">[新增个人费用]</a>
      </td>
   </tr>
    <tr bgcolor="#FFFFFF"> 
    	<td  align=left width="80%">
    			所属团体：
    			<select id="team" name="team">
                    	<option value="">----所有组----</option>
						<option value="0" <c:if test="${team=='0'}">selected="selected"</c:if> >----个 人----</option>
						<c:forEach items="${teamInfoList}" var="teamInfo">
							<option value="${teamInfo.id }" <c:if test="${team==teamInfo.id}">selected="selected"</c:if> >${teamInfo.teamName }</option>
						</c:forEach> 
                    </select>
                    
                     &nbsp;&nbsp; &nbsp;
                     <input  type="text"   value=""  onkeydown="serachTeam(this);"/>  （模糊过滤团体）
    			 
    	</td>
      
   </tr>
   <tr bgcolor="#FFFFFF"> 
       <td  >&nbsp;</td>
   </tr>
    <tr bgcolor="#FFFFFF"> 
    	<td  align=left width="80%">
    			 
                 分类关键字：
                <input type="text" name="classifyName"  value="${ classifyName}"/>
                
    			 
    	</td>
      
   </tr>
   <tr bgcolor="#FFFFFF"> 
       <td  >&nbsp;</td>
   </tr>
   <tr bgcolor="#FFFFFF"> 
    	<td  align=left width="80%">
    			时间过滤：
    			<input id="begin_generatedDate" readonly="readonly" name="begin_generatedDate" class="Wdate" type="text" value="${ begin_generatedDate}"
    			onFocus="WdatePicker()"/> 　
                
                至
                <input id="end_generatedDate" readonly="readonly" name="end_generatedDate" class="Wdate" type="text" value="${ end_generatedDate}"
    			onFocus="WdatePicker()"/> 
                
                 &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;
                 
                
    			<input type="button" value="搜索"  onclick="search();"> 
    	</td>
       
   </tr>
   <tr bgcolor="#FFFFFF"> 
       <td  >&nbsp;</td>
   </tr>
  </table>
  
<table width="80%" height="165" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#000000">
  <tr bgcolor="#FFFFFF"> 
    <td  class="s5"><div align="center">所属团体</div></td>
    <td  class="s5"><div align="center">时间</div></td>
    <td  class="s5"><div align="center">分类</div></td>
    <td  class="s5"><div align="center">备注</div></td>
    <td  class="s5"><div align="center">参与人与付出费用</div></td>
     <td  class="s5"><div align="center">
     	<select id="balanced" name="balanced" onchange="search();">
    		<option value=""  >是否结算</option>
    		<option value="0" <c:if test="${balanced=='0'}">selected="selected"</c:if> >否</option>
    		<option value="1" <c:if test="${balanced=='1'}">selected="selected"</c:if>>是</option>
    	</select>
     </div></td>
    <td  class="s5"><div align="center">操作</div></td>
  </tr>
 
 <c:forEach items="${expensesInfoList}" var="expensesInfo">
 	<tr bgcolor="#FFFFFF"> 
     <td class="s4">
    	<div align="center">
    		<c:choose>
    			<c:when test="${expensesInfo.teamId ==0}">
    				个 人
    			</c:when>
    			<c:otherwise>
    				<aap:getValueByTableAndColumn tabname="T_AAP_TEAM" idName="ID" idValue="${expensesInfo.teamId }" colname="TEAMNAME"></aap:getValueByTableAndColumn>
    			</c:otherwise>
    		</c:choose>
    		
    	</div>
    </td>
    <td class="s4">
    	<div align="center">
    		
    		<fmt:formatDate value="${expensesInfo.generatedDate }" type="date" dateStyle="default" />
    	</div>
    </td>
     <td class="s4">
    	<div align="center">${expensesInfo.classifyName }</div>
    </td>
    <td class="s4">
    	<div align="center">${expensesInfo.discription }</div>
    </td>
    <td class="s4">
    		<c:forEach items="${expensesInfo.detailsList}" var="detailsInfo">
    			<div align="center">
    			 
    			<aap:getValueByTableAndColumn tabname="t_aap_user" idName="UID" idValue="${detailsInfo.uid }" colname="NAME"></aap:getValueByTableAndColumn>
    			：${detailsInfo.alreadyPay }元（人民币）</div>
    		</c:forEach>
    		 
    </td>
    <td class="s4"> 
    	<div align="center">
    		<c:choose>
    			<c:when test="${expensesInfo.balanced==true}">
    				是
    			</c:when>
    			<c:otherwise>
    				否
    			</c:otherwise>
    		</c:choose>
		</div>
    </td>
   
    <td class="s4"><div align="center">
    
    	<a href='javascript:updateSingleData(${expensesInfo.eid });'>修改</a>
	  	<a href="javascript:deleteSingleData(${expensesInfo.eid });">删除</a>
    				 
    </div></td>
  </tr>
 </c:forEach>
  
   
 
  <tr bgcolor="#FFFFFF">
    <td class="s4" colspan="7">
    	<div align="right">
			 <nsrm:paginate items="paginatedList" />
	 	</div>
	</td>
 </tr>
</table>


</form>

</body>
</html>
<script type='text/javascript' src='<%=basePath%>dwr/engine.js'></script>
<script type='text/javascript' src='<%=basePath%>dwr/util.js'></script>
<script type='text/javascript' src='<%=basePath%>dwr/interface/GetTeamDwr.js'></script>
<script type="text/javascript">

		//搜索团队
		function serachTeam(obj,evt){
			var evt=window.event?window.event:evt;
            if (evt.keyCode==13){
               GetTeamDwr.teamListByName(obj.value,function(data){
               	 var teamObj=document.getElementById("team");
               	 teamObj.options.length=0;
               	 
               	 if(obj.value==""){
               	 	var option_t=new Option("----所有组----","");
               	 	teamObj.add(option_t);
               	 	option_t=new Option("----个人----","0");
               	 	teamObj.add(option_t);
               	 }
               	 
               	 if(data!=null){
               	 	for(var i=0;i<data.length;i++){
               	 		var teamValue=data[i];
               	 		var option =new Option(teamValue.teamName,teamValue.id);
               	 		 
               	 		teamObj.add(option);
               	 	}
               	 }
               	  
               	 
               	 
               });
            }
		}
	
	//费用信息查询过滤	
	function search(){
		document.all.frm.submit();
	}
	
	
	//新增团体费用
	function addTeamData(){
		window.location.href="ExpensesInfoServlet.servlet?opt=toAddTeamData";
	
	}
	
	//新增个人费用
	function addIndividualData(){
		window.location.href="ExpensesInfoServlet.servlet?opt=toAddIndividualData";
	}
	
	//删除费用
	function deleteSingleData(eid){
		if(confirm('是否确定删除?')){
			window.location.href="ExpensesInfoServlet.servlet?opt=deleteSingleData&eid="+eid;
		}
	}
	
	//修改费用
	function updateSingleData(eid){
		window.location.href="ExpensesInfoServlet.servlet?opt=toUpdateSingleData&eid="+eid;
	}
		
</script>
